package org.example.DesignPatterns.Visitor;

import java.time.LocalDate;
import java.util.Arrays;
import java.util.List;

/**
 * @description:
 * @author: farprt
 * @create: 2022-09-24 15:19
 **/
public class Client {

    public static void main(String[] args) {

        List<Acceptable> products= Arrays.asList(
                new Candy("candy", LocalDate.of(2019,10,1),20.00f),
                new Wine("wine",LocalDate.of(2917,1,1),1000f)
        );

        Visitor discountVisitor=new DiscountVisitor(LocalDate.of(2020,1,1));
        for(Acceptable product:products){
//            discountVisitor.visit(product); //报错
            product.accept(discountVisitor);
        }

    }
}